/*
 * Copyright (c) 2015. For Intelligent Group.
 */

package com.intelligent.ispc.client.event;

import com.google.common.eventbus.Subscribe;
import com.intelligent.ispc.client.core.view.analysis.report.YieldPanel;
import com.intelligent.ispc.client.core.view.analysis.spc.SpcMainPanel;
import com.intelligent.ispc.client.utils.ApplicationBeanUtils;
import com.intelligent.ispc.client.utils.UIConstant;

/**
 * Created by cherry on 2016/8/18.
 */
public class SearchItemDoubleClickListener {

    /**
     * Subscribe event for click item.
     *
     * @param event SearchItemDoubleClickEvent
     */
    @Subscribe
    public void click(SearchItemDoubleClickEvent event) {
        if (event.getKey().equals(UIConstant.MODULE_SPC)) {
            if (ApplicationBeanUtils.getBean(SpcMainPanel.class).getSearchBtnStatus()) {
                ApplicationBeanUtils.getBean(SpcMainPanel.class).fireSearchActionPerformed();
            }
        } else if (event.getKey().equals(UIConstant.MODULE_YIELD)) {
            if (ApplicationBeanUtils.getBean(YieldPanel.class).getSearchBtnStatus()) {
                ApplicationBeanUtils.getBean(YieldPanel.class).fireSearchActionPerformed();
            }
        }
    }

}
